package operation;

import book.Booklist;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: XMQ
 * Date: 2022-05-18
 * Time: 8:19
 */
public class BorrowOperation implements IOperation{
    @Override
    public void work(Booklist booklist) {
        System.out.println("借阅图书！");
        System.out.println("请你输入你要借阅的书名：");
        Scanner scan = new Scanner(System.in);
        String name = scan.nextLine();
        for (int i = 0; i <booklist.getUseSize() ; i++) {
            if(booklist.getBooks(i).getName().equals(name)){
                booklist.getBooks(i).setBoolean(true);
                System.out.println("借阅成功！");
                return;
            }
        }
    }
}
